import request from '@/utils/request'

export function getProductInventory(query) {
  return request({
    url: '/mall/api/distributor/distribution/product-inventory',
    method: 'get',
    params: query
  })
}

export function booking(data) {
  return request({
    url: '/mall/api/distributor/distribution/booking',
    method: 'post',
    data
  })
}

export function getGrouponByPage(query) {
  return request({
    url: '/mall/api/distributor/distribution/groupon',
    method: 'get',
    params: query
  })
}

export function getGrouponById(id) {
  return request({
    url: '/mall/api/distributor/distribution/groupon/' + id,
    method: 'get'
  })
}

export function getOrderByPage(query) {
  return request({
    url: '/mall/api/distributor/distribution/order',
    method: 'get',
    params: query
  })
}

export function downloadOrder(param) {
  return request({
    url: '/mall/api/distributor/distribution/order/download',
    method: 'post',
    data: param,
    responseType: 'blob',
    timeout: 30000
  })
}

export function payAllOrder() {
  return request({
    url: '/mall/api/distributor/distribution/order/pay-all',
    method: 'post'
  })
}

export function paySelectedOrder(data) {
  return request({
    url: '/mall/api/distributor/distribution/order/pay-selected',
    method: 'post',
    data
  })
}

export function getOrderById(id) {
  return request({
    url: '/mall/api/distributor/distribution/order/' + id,
    method: 'get'
  })
}

export function putOrderById(id, data) {
  return request({
    url: '/mall/api/distributor/distribution/order/' + id,
    method: 'put',
    data
  })
}

export function getTradeByPage(query) {
  return request({
    url: '/mall/api/distributor/distribution/trade',
    method: 'get',
    params: query
  })
}

export function getTradeById(id) {
  return request({
    url: '/mall/api/distributor/distribution/trade/' + id,
    method: 'get'
  })
}

export function putTradeById(id, data) {
  return request({
    url: '/mall/api/distributor/distribution/trade/' + id,
    method: 'put',
    data
  })
}

export function getDiscountByPage(query) {
  return request({
    url: '/mall/api/distributor/distribution/discount',
    method: 'get',
    params: query
  })
}

export function getDeliveryChargeByPage(query) {
  return request({
    url: '/mall/api/distributor/distribution/delivery-charge',
    method: 'get',
    params: query
  })
}

export function getGoodsDemandByPage(query) {
  return request({
    url: '/mall/api/distributor/distribution/goods-demand',
    method: 'get',
    params: query
  })
}

export function addGoodsDemand(data) {
  return request({
    url: '/mall/api/distributor/distribution/goods-demand',
    method: 'post',
    data
  })
}

export function getGoodsDemandById(id) {
  return request({
    url: '/mall/api/distributor/distribution/goods-demand/' + id,
    method: 'get'
  })
}

export function putGoodsDemandById(id, data) {
  return request({
    url: '/mall/api/distributor/distribution/goods-demand/' + id,
    method: 'put',
    data
  })
}

export function getMyFavoriteByPage(query) {
  return request({
    url: '/mall/api/distributor/distribution/my-favorite',
    method: 'get',
    params: query
  })
}

export function addMyFavorite(data) {
  return request({
    url: '/mall/api/distributor/distribution/my-favorite',
    method: 'post',
    data
  })
}

export function deleteMyFavoriteById(id) {
  return request({
    url: '/mall/api/distributor/distribution/my-favorite/' + id,
    method: 'delete'
  })
}
